#ifndef __LOGHANDLER_HEADER
#define __LOGHANDLER_HEADER

#define LOG_DEBUG 	0
#define LOG_INFO	1
#define LOG_ERROR	2

#define LOG_STDOUT	(1<<0)
#define LOG_FILE	(1<<1)

#include <unistd.h>
#include <pthread.h>
#include <string.h>
#include <fcntl.h>

class LogHandler {
private:
	pthread_mutex_t mutex;
	void debug(int mask, const char *text, const char *file = NULL);
	void info(int mask, const char *text, const char *file = NULL);
	void error(int mask, const char *text, const char *file = NULL);
public:
	LogHandler();
	~LogHandler();
	void log(int level, int mask, const char *text, const char *file = NULL);
};

#endif // __LOGHANDLER_HEADER

